package com.caigou.service.impl;

import com.caigou.bean.cms.entity.GTest;
import com.caigou.mapper.cms.Test1Mapper;
import com.caigou.mapper.exam.Test2Mapper;
import com.caigou.service.Test1Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class Test1ServiceImpl implements Test1Service {
    @Resource
    private Test1Mapper test1Mapper;
    @Resource
    private Test2Mapper test2Mapper;

    @Override
    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Throwable.class)
    public void save(GTest gTest) {
        test1Mapper.save(gTest);
    }

    @Override
    public void save2(GTest gTest) {
        test1Mapper.save(gTest);
        gTest.setName("1234567");
        test2Mapper.save(gTest);
    }
}
